home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 08 - 1992 / 08.06 Oct 92 / One-Application Patches / dollars.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-08  |  870 b   |  35 lines  |  [TEXT/KAHL]

  1. /*    ---------------------------------------------
  2.         dollars.c    When a dollar sign is typed, type
  3.                                 another one    and then a left arrow.
  4.             
  5.         THINK C "Set Project Type..." settings:
  6.         code resource, type 'OAPe', ID 1001,
  7.         custom header, preloaded and locked,
  8.         file type 'rsrc', file creator 'RSED'.
  9.         ---------------------------------------------
  10. */
  11. void main( EventRecord *evt );
  12.  
  13. #define        LEFT_ARROW_MESSAGE        0x00027B1CL
  14.  
  15. void main( EventRecord *event )
  16. {
  17.     EvQEl    *event_q_data;
  18.  
  19.     /*
  20.         In this case we have to be careful to avoid
  21.         causing an infinite loop, so we post an
  22.         abnormal dollar message, with no key code.
  23.     */
  24.  
  25.     if ( (event->what == keyDown) &&
  26.         ((event->message & charCodeMask) == '$') &&
  27.         (event->message != '$') )
  28.     {
  29.         PostEvent( keyDown, '$' );
  30.         PPostEvent( keyDown, LEFT_ARROW_MESSAGE,
  31.             &event_q_data );
  32.         event_q_data->evtQModifiers = 0;
  33.     }
  34. }
  35.